package com.bdqn.Di3Zhan;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import org.apache.log4j.Logger;

import java.lang.reflect.Method;

public class IntermediaryMethodInterceptor implements MethodInterceptor {

    private Logger log = Logger.getLogger(IntermediaryMethodInterceptor.class);

    @Override
    public Object intercept(Object Proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
            before();

            Object feedback = methodProxy.invokeSuper(Proxy , args);

            after();

            return "看房记录，买房反馈”"+feedback+"“";
    }

    private void after() {
        log.debug("后期跟踪");
        log.debug("和买家沟通建议");
    }

    private void before() {
        log.debug("前期准备");
        log.debug("找房资源");
        log.debug("和买家沟通意见");
    }
}
